<tc_include file="Public:head" />
<body class="J_scroll_fixed body-white" id="top">
<div class="wrap J_check_wrap">
<script type="text/javascript">
function radioShow(){
	var oneclass=document.getElementsByName("oneclass"); 
	var div=document.getElementById("c").getElementsByTagName("div");
	for(i=0;i<div.length;i++){
		if(oneclass[i].checked){
		div[i].style.display="block";
		}
		else{
		div[i].style.display="none";
		}
	}
}
</script>
<style> 
tr{height: 34px;}
.radio {margin-top: 5px; min-width: 100px; float: left;}
.btnclick{width: 32px;}
.inpwidth{width: 106px;}
.selwidth{width: 185px;}
</style>
<php>
  	$main_typeid = array();
	for ($i = 0;$i<count($teams);$i++) {
			$typeid = $teams[$i]["id"];
			$main_typeid[$i] = $typeid;
	}
</php>
<div class="container tc-main">
    <div class="row">
        <div class="span12">
    <form method="post" class="form-horizontal J_ajaxForm" action="{:U('game/update_post')}" name="formadd">
      <div class="table_list">
        <table cellpadding="2" cellspacing="2" width="100%">
          <tbody>
            <tr>
              <td><button type="submit" class="btn btn-primary btn_submit  J_ajax_submit_btn">更新</button></td>
              <td><button type="button" class="btn" onclick="javascript:history.go(-1);">返回</button></td>
            </tr>
            <tr>
              <td colspan=2>{$infos.matchdesc}</td>
            </tr>
            <tr>
              <td>对战球队:</td>
              <td>
        			<foreach name="teams" item="vo">
						<if condition="$vo['constid'] eq $infos['teamid1'] || $vo['teamnumber'] eq $infos['teamid1']">
							{$vo.teamname}
		        		</if>
        			</foreach>
        			：
        			<foreach name="teams" item="vo">
						<if condition="$vo['constid'] eq $infos['teamid2'] || $vo['teamnumber'] eq $infos['teamid2']">
							{$vo.teamname}
		        		</if>
        			</foreach>
               </td>
            </tr>
            <tr>
              <td>开赛时间:</td>
              <td>{$infos.matchdatetime}</td>
            </tr>
            <tr>
              <td>选择球队:</td>
              <td>
        			<foreach name="teams" item="vo">
						<if condition="$vo['constid'] eq $infos['teamid1'] || $vo['teamnumber'] eq $infos['teamid1']">
							<label class="radio">
								<input name="oneclass" type="radio" value="{$infos.matchconstid},{$vo.teamname},1" onclick="radioShow();" checked/>{$vo.teamname}
							</label>
		        		</if>
        			</foreach>
        			<foreach name="teams" item="vo">
						<if condition="$vo['constid'] eq $infos['teamid2'] || $vo['teamnumber'] eq $infos['teamid2']">
							<label class="radio">
								<input name="oneclass" type="radio" value="{$infos.matchconstid},{$vo.teamname},2"  onclick="radioShow();" />{$vo.teamname}
							</label>
		        		</if>
        			</foreach>
               </td>
            </tr>
            <tr>
              <td>选择球员:</td>
				<td>
					<div id="c">
						<div>
							<select name="twoclass" class="selwidth">   
								<option value="0">--请选择队员--</option>
<php>
		for ($i = 0;$i<count($userroles);$i++) {
			if($userroles[$i]["relatedID"] == $main_typeid[0]){
					echo '<option value="';
					for ($l = 0;$l<count($userdetails);$l++) {
						if($userroles[$i]['relatedUserID'] == $userdetails[$l]['relatedUserID']){
							$user = $userroles[$i]['id'];
							echo preg_replace('/\r|\n/', '', $user);
							break;
						}
					}
					if($userroles[$i]["play_number"] !=''){
						$num = $userroles[$i]["play_number"];
						echo ','.preg_replace('/\r|\n/', '', $num).'">';
					}else{
						echo ',0">';
					}
			}
			if($userroles[$i]["relatedID"] == $main_typeid[0]){
					for ($k = 0;$k<count($typeconfigs);$k++) {
						if($userroles[$i]['roleTypeID'] == $typeconfigs[$k]['typeID']){
							$type = $typeconfigs[$k]['typeName'].' — ';
							echo preg_replace('/\r|\n/', '', $type);
							break;
						}
					}
					for ($l = 0;$l<count($userdetails);$l++) {
						if($userroles[$i]['relatedUserID'] == $userdetails[$l]['relatedUserID']){
							$user = $userdetails[$l]['realname'];
							if($user == ''){
								$user = '未填写';
							}
							echo preg_replace('/\r|\n/', '', $user);
							break;
						}
					}
					if($userroles[$i]["play_number"] !=''){
						$num = $userroles[$i]["play_number"];
						echo ' — '.preg_replace('/\r|\n/', '', $num).'号</option>';
					}else{
						echo '</option>';
					}
			}
		}
</php>
							</select>
						</div>
						<div style="display:none;">
							<select name="threeclass" class="selwidth">   
								<option value="0">--请选择队员--</option>
<php>
		for ($i = 0;$i<count($userroles);$i++) {
			if($userroles[$i]["relatedID"] == $main_typeid[1]){
					echo '<option value="';
					for ($l = 0;$l<count($userdetails);$l++) {
						if($userroles[$i]['relatedUserID'] == $userdetails[$l]['relatedUserID']){
							$user = $userroles[$i]['id'];
							echo preg_replace('/\r|\n/', '', $user);
							break;
						}
					}
					if($userroles[$i]["play_number"] !=''){
						$num = $userroles[$i]["play_number"];
						echo ','.preg_replace('/\r|\n/', '', $num).'">';
					}else{
						echo ',0">';
					}
			}
			if($userroles[$i]["relatedID"] == $main_typeid[1]){
					for ($k = 0;$k<count($typeconfigs);$k++) {
						if($userroles[$i]['roleTypeID'] == $typeconfigs[$k]['typeID']){
							$type = $typeconfigs[$k]['typeName'].' — ';
							echo preg_replace('/\r|\n/', '', $type);
							break;
						}
					}
					for ($l = 0;$l<count($userdetails);$l++) {
						if($userroles[$i]['relatedUserID'] == $userdetails[$l]['relatedUserID']){
							$user = $userdetails[$l]['realname'];
							if($user == ''){
								$user = '未填写';
							}
							echo preg_replace('/\r|\n/', '', $user);
							break;
						}
					}
					if($userroles[$i]["play_number"] !=''){
						$num = $userroles[$i]["play_number"];
						echo ' — '.preg_replace('/\r|\n/', '', $num).'号</option>';
					}else{
						echo '</option>';
					}
			}
		}
</php>
							</select>
						</div>
					</div>
				</td>
            </tr>
            <tr>
              <td>进球数:</td>
		      <td>
				<input type="button" value="─" class="btn btnclick" onClick="javascript:this.form.enter.value--;">
				<input type="text" name="enter" class="input inpwidth" value="0"readonly="readonly">
				<input type="button" value="┼" class="btn btnclick" onClick="javascript:this.form.enter.value++;">
		      </td>
            </tr>
            <tr>
              <td>黄牌数:</td>
		      <td>
				<input type="button" value="─" class="btn btnclick" onClick="javascript:this.form.yellow.value--;">
				<input type="text" name="yellow" class="input inpwidth" value="0"readonly="readonly">
				<input type="button" value="┼" class="btn btnclick" onClick="javascript:this.form.yellow.value++;">
		      </td>
            </tr>
            <tr>
              <td>红牌数:</td>
		      <td>
				<input type="button" value="─" class="btn btnclick" onClick="javascript:this.form.red.value--;">
				<input type="text" name="red" class="input inpwidth" value="0"readonly="readonly">
				<input type="button" value="┼" class="btn btnclick" onClick="javascript:this.form.red.value++;">
		      </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="form-actions">
        <button type="submit" class="btn btn-primary btn_submit  J_ajax_submit_btn">更新</button>
        <button type="button" class="btn" onclick="javascript:history.go(-1);">返回</button>
      </div>
    </form>
		</div>
	</div>
		      <div class="p10"><div class="pages"> {$Page} </div> </div>
		       		<table class="table table-bordered table-striped table-hover">
				    <thead>
				      <tr>
				        <th style="min-width: 60px;">球队-号码</th>
				        <th>进球</th>
				        <th>红牌</th>
				        <th>黄牌</th>
				        <th>操作</th>
				      </tr>
				    </thead>
				    <tbody>
				    <foreach name="lists" item="vo">
				      <tr>
				        <td>{$vo.description}</td>
				        <td>{$vo.goals}</td>
				        <td>{$vo.red_card}</td>
				        <td>{$vo.yellow_card}</td>
				        <td>
				        	<a href="{:U('game/player',array('id'=>$vo['id']))}">修改</a>
				        </td>
				      </tr>
				    </foreach>
				    </tbody>
				  </table>
		      <div class="p10"><div class="pages"> {$Page} </div> </div>
	</div>
</div>
<tc_include file="Public:footer" />
</body>
</html>